<template>
    <div id="AsnDetail">
        <div class="detail">
            <component :inputData="detailData" :is="currentComponent"></component>
        </div>
    </div>

</template>

<script>
    import detail from "commons/Detail";
    import navMenu from "commons/NavMenu";
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "AsnDetail",
        mixins: [baseMixin],
        data() {
            return {
                newFlag: false,
                selectData: {},
                detailData: {},
                detailNav: "1",
                componentConfig: [
                    {
                        name: "ZoneDetails",
                        label: this.$t('bill.detail'),
                        component: () => import('./page/particulars.vue')
                    }
                ]
            }
        },
        computed: {
            currentComponent() {
                return this.componentConfig[this.detailNav - 1].component;
            }
        },
        methods: {
            async getData() {
                try {
                    let res = await this.$api.get(`/queryLottableByKey/${this.selectData.lottablevalidationkey}/${this.$store.state.wms}`);
                    
                        this.detailData = res.bean;
                    
                } catch (e) {
                    this.$message.error(e);
                }
            },
            setdata(data, id, close) {
                this.detailData.toloc = data.loc;
                close(false);
            }
        },
        mounted() {
            this.newFlag = this.$store.state.newFlag;
            if (Object.keys(this.$store.state.skip).length !== 0) {
                let data = this.$store.state.skip;
                this.detailData = data.detail;
                this.selectData = data.routeData;
                this.detailNav = data.detailNav;
                this.$store.commit("setNewFlag", data.newFlag)
            } else if (this.newFlag) {
                this.detailData = {
                    showlottable01onrfreceipt: "0",
                    showlottable02onrfreceipt: "0",
                    showlottable03onrfreceipt: "0",
                    showlottable04onrfreceipt: "0",
                    showlottable05onrfreceipt: "0",
                    showlottable06onrfreceipt: "0",
                    showlottable07onrfreceipt: "0",
                    showlottable08onrfreceipt: "0",
                    showlottable09onrfreceipt: "0",
                    showlottable10onrfreceipt: "0",
                    lottable01onrfreceiptmandatory: "0",
                    lottable02onrfreceiptmandatory: "0",
                    lottable03onrfreceiptmandatory: "0",
                    lottable04onrfreceiptmandatory: "0",
                    lottable05onrfreceiptmandatory: "0",
                    lottable06onrfreceiptmandatory: "0",
                    lottable07onrfreceiptmandatory: "0",
                    lottable08onrfreceiptmandatory: "0",
                    lottable09onrfreceiptmandatory: "0",
                    lottable10onrfreceiptmandatory: "0",
                    comminglelottable1: "1",
                    comminglelottable2: "1",
                    comminglelottable3: "1",
                    comminglelottable6: "1",
                    comminglelottable7: "1",
                    comminglelottable8: "1",
                    comminglelottable9: "1",
                    comminglelottable10: "1",
                    genmaxlength01: 50,
                    genmaxlength02: 50,
                    genmaxlength03: 50,
                    genmaxlength06: 50,
                    genmaxlength07: 50,
                    genmaxlength08: 50,
                    genmaxlength09: 50,
                    genmaxlength10: 50,
                    showlottable11onrfreceipt: "0",
                    showlottable12onrfreceipt: "0",
                    lottable11onrfreceiptmandatory: "0",
                    lottable12onrfreceiptmandatory: "0",
                    maskgenrule01: "0",
                    maskgenrule02: "0",
                    maskgenrule03: "0",
                    maskgenrule06: "0",
                    maskgenrule07: "0",
                    maskgenrule08: "0",
                    maskgenrule09: "0",
                    maskgenrule10: "0",
                };
            } else {
                this.selectData = this.$store.state.routeData;
                this.getData();
            }
        },
        components: {
            "v-detail": detail,
            "v-navMenu": navMenu,
        },

    }
</script>

<style scoped>

</style>
